Skip to content

Conversation

@darbyjohnston
Copy link
Contributor

I have been seeing occasional CI failures with this error:

======================================================================
FAIL: test_serialization_round_trip (test_v2d.V2dTests.test_serialization_round_trip)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:/a/OpenTimelineIO/OpenTimelineIO/tests/test_v2d.py", line 112, in test_serialization_round_trip
    self.assertEqual(v2d, deserialized)
AssertionError: otio.schema.V2d(x=1.2375583497411374e+214, y=3.503154865959304e+151) != otio.schema.V2d(x=1.2375583497411374e+214, y=3.5031548659593044e+151)

----------------------------------------------------------------------
Ran 489 tests in 13.798s

FAILED (failures=1, skipped=2)
make: *** [Makefile:79: coverage-core] Error 1
Error: Process completed with exit code 2.

It looks like the variables being used are not initialized, causing them to have random values that can trigger the failure. I'm not sure why the serialization is failing but we should probably initialize the values so the tests are consistent.

Signed-off-by: Darby Johnston <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.00%. Comparing base (c0e97b0) to head (852b766).
⚠️ Report is 76 commits behind head on main.

❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1955      +/-   ##
==========================================
+ Coverage   84.11%   85.00%   +0.88%     
==========================================
  Files         198      181      -17     
  Lines       22241    13074    -9167     
  Branches     4687     1206    -3481     
==========================================
- Hits        18709    11113    -7596     
+ Misses       2610     1778     -832     
+ Partials      922      183     -739     
Flag Coverage Δ
py-unittests 85.00% <100.00%> (+0.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tests/test_v2d.py 97.46% <100.00%> (+0.36%) ⬆️

... and 139 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f1cad2...852b766. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@apetrynet
Copy link
Contributor

Good catch!
Sneaky bug indeed.

However, should we look into why an uninitialized v2d gets a random value? I would think the serialized value of an "empty" v2d should be null, [] or even [0,0]?
Perhaps we should look at the otio implementation of v2d? I assume the random values stem from old data in memory at some location, but I'm in no way a C++ expert

@darbyjohnston
Copy link
Contributor Author

The default v2d constructor in C++ doesn't initialize the values, so it can be any random memory value as you point out. This is done on purpose, I believe as an optimization. For example if you create a vector of ten thousand v2d values, you might not want the overhead of assigning zero to all of them.

I'm not a Python expert, does Python have the concept of uninitialized values? Maybe the Python bindings should initialize the values unlike the C++ code.

It's also interesting that the serialization fails, but maybe crazy numbers like 3.503154865959304e+151 aren't handled.

@jminor
Copy link
Collaborator

jminor commented Oct 10, 2025

Python doesn't have that notion, and some languages are moving away from uninitialized variables as a guard against unexpected bugs or security issues (e.g. reading passwords from someone else's freed memory).
I think we should make that constructor initialize with zeros if possible. Maybe that's possible in the bindings layer?
With that said, I would happily accept this PR as-is and handle that task in a future PR.

@darbyjohnston
Copy link
Contributor Author

It should be fairly simple to initialize the values in the bindings, I can create a separate PR for that. I think we should merge this PR so there aren't any more random CI failures. Plus using values like v2d(0.1, 0.2) is probably better for serialization tests than v2d(0, 0).

@darbyjohnston darbyjohnston added this to the Public Beta 18 milestone Oct 10, 2025
@darbyjohnston darbyjohnston added the bug A problem, flaw, or broken functionality. label Oct 10, 2025
@darbyjohnston darbyjohnston merged commit 19d12b8 into AcademySoftwareFoundation:main Oct 10, 2025
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A problem, flaw, or broken functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants